<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'Connection.php';
class Player{
    private $id;
    private $name;
    private $level;
    private $exp;
    private $socket;

    public function __construct(){
            $this->id = 0;
            $this->name = "";
            $this->level = 0;
            $this->exp = 0;
            $this->socket = "";
    }

    public static  function LoadPlayer($socket){
        $connection = new Connection();
        $connection->open();
        $query = "select id, name, level, exp, socket from player where level = 1";
        $result = mysql_query($query, $connection->connection);
        $player = new Player();
        while ($row = mysql_fetch_array($result)) {
                $player->id = $row['id'];
                $player->name = $row['name'];
                $player->level = $row['level'];
                $player->exp = $row['exp'];
                $player->socket = $row['socket'];
        }

        return $player;
    }
}
?>
